<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/base.css">
    <script src="__STATIC__/js/swiper.min.js"></script>
    <script src="__STATIC__/js/jquery-1.8.2.js"></script>
    <title>天天特价</title>
    <script>
        $(function(){
            $(".down img").click(
                    function(){
                        $('.board').css('height',window.screen.availHeight+'px');
                        var str = $(this).prop('src'),
                                header = $('.header').height(),
                                tablist = $('.tablist').height(),
                                zhi = str.substring(str.length-8,str.length);
                        var swiperH = $('.swiper-container:visible').height();
                        if (zhi == "down.png"){
                            $(this).prop("src","__STATIC__/img/top3.png");
                            $('.board').css({'display':'block','top':header+tablist+swiperH+1});
                            $('body').css('overflow','hidden');
                            $(".type").css('display','block');
                        }else{
                            $(this).prop("src","__STATIC__/img/down.png");
                            $('.board').css('display','none');
                            $('body').css('overflow','');
                            $(".type").css('display','none');
                            $('.swiper-container').each(function (i,o) {
                                $(o).css('display','none');
                            })
                        }
                        $(".board").css({height:"h"});
                    }
            )
        })
    </script>
    <style>
        .board {
            position: absolute;
            width: 100%;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background: #000;
            opacity: 0.5;
            height:500px;
            display: none;
        }
        .swiper-wrapper #cur{
            border:1px solid #E73F09;
            color: #E73F09;
        }
    </style>
    {include file="public/href" /}
</head>
<body>
<div class="wrap-off">
    <div class="header">
        <p>天天特价</p>
        <img src="__STATIC__/img_user/back.png" class="back" onclick=window.location.href="{:url('mobile/user_port/index')}">
    </div>
    <div class="swiper-container menu_container">
        <ul class="swiper-wrapper">
            <li class="swiper-slide"><a href="{:url('user_action/day_off_price')}">全部</a></li>
            {volist name="type" id="vo"}
            <li class="swiper-slide"><a href="{:url('user_action/day_off_price')}?type_id={$vo.id}">{$vo.title}</a></li>
            {/volist}
        </ul>
        <script>
            var swiper0 = new Swiper('.menu_container', {
                slidesPerView: 5,
                paginationClickable: true,
                spaceBetween: 10,
                freeMode: true
            });
        </script>
    </div>
    <div class="tabcon">
        <div class="cur">
            <ul class="list">
            </ul>
        </div>
    </div>
</div>

</div>
<div class="board"></div>
{include file="public/src" /}
<script>
    //点击父类栏目显示子类栏目
    function jump(id){

        if ($("#son_"+id).find('.swiper-wrapper').children('div').size() != 0){

            $('#son_'+id).toggle().siblings('.swiper-container').css('display','none');

            $('.type').css('display','none');

            var sonH = $('#son_'+id).height();
            var tabH  = $('.tablist').height();
            var headH = $('.header').height();
            $('.board').css('top',(headH+tabH+sonH+15)+'px');
            if ($('#son_'+id).css('display') == 'block'){
                $('.board').css('display','block');
                $('body').css('overflow','hidden');
            }else{
                $('.board').css('display','none');
                $('body').css('overflow','');
            }

        }

    }
    //layer流加载
    layui.use('flow', function() {
        var $ = layui.jquery;
        var flow = layui.flow;
        flow.load({
            elem: '.list' //流加载容器
            ,isAuto:true
            ,isLazyimg:true
            ,done: function(page, next){ //执行下一页的回调
                var lis = [];

                $.ajax({
                    url:"{:url('mobile/user_action/day_off_price')}",
                    dataType:'json',
                    type:'post',
                    data:{'page':page,'type_id':"{:input('type_id','')}"},
                    success:function(t){
                        layui.each(t.data, function(index, item){

                            lis.push('<li><a href="javascript:jump_goods_details('+item.goods_id+');"><div class="goods">' +
                                        '<img lay-src="/'+item.thumb_img+'"><p>销量 &nbsp;'+item.sale_number+'</p>' +
                                        '</div><a href="javascript:jump_goods_details('+item.goods_id+');"><h4 style="height: 40px;">'+item.title+'</h4></a>' +
                                        '<div class="price">&yen;'+item.sale_price+'<span>&yen;'+item.price+'</span></div></a></li>'
                                );


                        });
                        next(lis.join(''), page < t.pages);
                    }
                })
            }
        });
    });
    //跳转到商品详情
    function jump_goods_details(goods_id){
        sessionStorage.setItem('goods_url_back',window.location.href);
        window.location.href = "{:url('mobile/user_category/goods_details')}?goods_id="+goods_id;
    }
</script>
</body>
</html>